package com.jiyun.common.dto;


import lombok.Data;

import java.io.Serializable;

@Data
public class R implements Serializable {
    //状态码
    //1成功，0失败
    private Integer code;
    private Object data;
    private String message;


    //成功，不带data
    public static R successL(){
        R r = new R();
        r.setCode(1);
        return r;
    }

    //成功，带data
    public static R success(Object data){
        R r = new R();
        r.setCode(1);
        r.setData(data);
        return r;
    }

    //失败
    public static R error(String message){
        R r = new R();
        r.setCode(0);
        r.setMessage(message);
        return r;
    }
}
